package com.idheima.Map.TreeMap;

import java.util.*;

public class Test {
    public static void main(String[] args) {
        //存储省份和所包含的城市信息
        //对应的类型，键：String，值有多个选择List<String>
        Map<String, List<String>> map = new HashMap<>();
        String province = "河北";
        List<String> he = List.of("石家庄", "廊坊", "承德", "秦皇岛", "唐山", "邢台", "张家口");
        map.put(province, he);
        String city = "河南";
        List<String> henan = List.of("郑州", "开封", "洛阳", "平顶山", "安阳", "鹤壁", "新乡", "焦作", "濮阳", "许昌", "漯河", "三门峡", "南阳", "商丘", "周口");
        map.put(city, henan);
        //遍历方式一：
        map.forEach((k,v)-> System.out.println(k+"="+v));
        System.out.println("===========================");
        //遍历方式二：
        map.entrySet().forEach(entry-> System.out.println(entry.getKey()+"="+entry.getValue()));

    }
}
